package com.xckj.teacher.ui.activity

import android.content.Intent
import com.xckj.teacher.R
import com.xckj.teacher.databinding.ActivityWelcomeBinding
import com.xckj.teacher.framework.BaseActivity
import com.xckj.teacher.util.CacheUtil

/**
 * 作者　: hegaojian
 * 时间　: 2020/2/22
 * 描述　:
 */
class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {


    override fun loadLayout(): Int {
        return R.layout.activity_welcome
    }

    override fun initData() {
        //防止出现按Home键回到桌面时，再次点击重新进入该界面bug
        if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT !== 0) {
            finish()
            return
        }
        if (!CacheUtil.getToken().isNullOrEmpty()) {
            startActivity(Intent(this, HomeActivity::class.java))
        } else {
            startActivity(Intent(this, LoginActivity::class.java))
        }
        finish()
    }

    override fun setListener() {
    }

    override fun isStatusBarDarkFont(): Boolean {
        return true
    }
}